﻿/* File Created: сентября 10, 2012 */
var cameraManager = null;
function CameraManager() {
    var $this = this;

    $this.pictureSource = Camera.PictureSourceType;   // picture source

    // A button will call this function
    //
    $this.capturePhoto = function (onSuccess) {
        // Take picture using device camera and retrieve image as base64-encoded string
        navigator.camera.getPicture(onSuccess, onFail, { quality: 50, destinationType: Camera.DestinationType.FILE_URI });
    };

    $this.capturePhotoData = function (onSuccess) {
        // Take picture using device camera and retrieve image as base64-encoded string
        navigator.camera.getPicture(onSuccess, onFail, { quality: 50, destinationType: Camera.DestinationType.DATA_URL });
    };

    // A button will call this function
    //
    $this.getPhoto = function (source, onSuccess) {
        // Retrieve image file location from specified source
        navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
            destinationType: Camera.DestinationType.FILE_URI,
            sourceType: source
        });
    };

    // Called if something bad happens.
    // 
    function onFail(message) {
        alert('Failed because: ' + message);
    };
}